package ru.yermak.bookkeeping.account;

import ru.yermak.bookkeeping.model.Account;

import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;

/**
 * User: harrier
 * Date: Sep 9, 2008
 */
public class MockAccountDao implements AccountDao {
    private Account insertedAccount;
    private HashMap<Integer, List<Account>> accountsByUserId = new HashMap<Integer, List<Account>>();
    private static int counter;

    public List<Account> findAccountsByUserId(Integer userId) {
        return accountsByUserId.get(userId);
    }

    public Integer insertAccount(Account account) {
        this.insertedAccount = account;
        this.insertedAccount.setId(++counter);
        return this.insertedAccount.getId();
    }

    public Account getById(Integer accountId) {
        return null;
    }

    public void updateAccount(Account account) {
        
    }

    public void removeAccount(Account account) {
        
    }

    public Account getInsertedAccount() {
        return insertedAccount;
    }

    public void putAccountsByUserId(Integer userId, List<Account> accounts) {
        accountsByUserId.put(userId, accounts);
    }
}
